]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/icon: Check icon name for empty string in setter function
authorJonas Dreßler <verdre@v0yd.nl>
Thu, 21 Nov 2019 12:05:11 +0000 (19:05 +0700)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 13 Jan 2020 13:44:08 +0000 (14:44 +0100)
Don't try to create a GIcon if the given icon name is empty, it will
lead to failure when loading the icon anyway, instead set the gicon to
NULL just as we do in the `set_gicon()` API when unsetting an icon.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/888

src/st/st-icon.c

index 8b8dbc2ff82a21990f143e4e6bb441f59d16962f..aa98ed2236a16abf6cff605f4811ec5033ffe71f 100644 (file)
@@ -553,7 +553,7 @@ st_icon_set_icon_name (StIcon      *icon,
 
   g_return_if_fail (ST_IS_ICON (icon));
 
-  if (icon_name)
+  if (icon_name && *icon_name)
     gicon = g_themed_icon_new_with_default_fallbacks (icon_name);
 
   g_object_freeze_notify (G_OBJECT (icon));
@@ -730,7 +730,7 @@ st_icon_set_fallback_icon_name (StIcon      *icon,
 
   g_return_if_fail (ST_IS_ICON (icon));
 
-  if (fallback_icon_name != NULL)
+  if (fallback_icon_name && *fallback_icon_name)
     gicon = g_themed_icon_new_with_default_fallbacks (fallback_icon_name);
 
   g_object_freeze_notify (G_OBJECT (icon));